package test;

import java.util.Scanner;


public class Homework4 {
    public static void main(String[] args) {
        String s1 = null, s2 = null;
        Scanner sc = new Scanner(System.in);
        try {
            System.out.println("请输入第一个字符串：");
            s1 = sc.next();
            System.out.println("请输入第二个字符串：");
            s2 = sc.next();
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        int i1 = Integer.parseInt(s1);
        int i2 = Integer.parseInt(s2);
        float f1 = Float.parseFloat(s1);
        float f2 = Float.parseFloat(s2);
        System.out.println(f1);
        System.out.println("拼接结果：" + strAdd(s1, s2));
        System.out.println("整型结果：" + strAdd(i1, i2));
        System.out.println("浮点结果：" + strAdd(f1, f2));
    }

    public static String strAdd(String str1, String str2) {
        return str1 + str2;
    }

    public static int strAdd(int a, int b) {
        return a + b;
    }

    public static String strAdd(float f11, float f22) {
        return String.valueOf(f11 + f22);
    }

}


